package com.moyuxi.sound_of_the_forest.sql

import androidx.lifecycle.LiveData
import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import androidx.room.Update
import com.moyuxi.sound_of_the_forest.entity.LocalMusicBean

@Dao
interface MusicListDao {
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun insertUsers(vararg bean: LocalMusicBean)//增

    @Delete
    fun deleteUser(bean: LocalMusicBean)//删除

    @Update
    fun updateUser(bean: LocalMusicBean)//修改

    @Query("SELECT * FROM MusicList")
    fun getAllBeanLiveData(): LiveData<List<LocalMusicBean>?>//表数据变化时，返回一个LiveData

    @Query("SELECT * FROM MusicList")
    fun getAllBean(): List<LocalMusicBean>?

}